package com.hiray.demos.ui_architect.litho.image

import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import com.facebook.litho.ComponentContext
import com.facebook.litho.annotations.*

@MountSpec
object ColorComponentSpec {

    @OnPrepare
    fun onPrepare(c: ComponentContext) {

    }


    @OnCreateMountContent
    fun onCreateMountContent(c: Context): ColorDrawable {
        return ColorDrawable()
    }

    @OnMount
    fun onMount(c: ComponentContext, colorDrawable: ColorDrawable, @Prop colorValue: String) {
        colorDrawable.color = Color.parseColor(colorValue)
    }
}